

//查询消耗预估
function query(pageNow) {
	
	rootPath = $('#rootPath').val();

	var customId = $('#customId').val();
	var empId = $('#emp').val();
	var regionalId = $('#area').val();
	var startTime = $('#startTime').val();
	var endTime = $('#endTime').val();
	var consumePhase = $('#consumePhase').val();
	var businessType = $('#businessType').val();
	var consumeState = $('#consumeState').val();
	var product = $('#productCode').val();
	if(!checkForm()) {
		return ;
	}
	var url = rootPath + "/serviceManage/queryfindxiao";
	$.post(
		url,
		{
			"cusId": customId,
			"empId": empId,
			"regionalId": regionalId,
			"startTime": startTime,
			"endTime": endTime,
			"consumePhase":consumePhase,
			"businessType":businessType,
			"state":consumeState,
			"product": product,
			"pageNow": pageNow
		},
		function(data) {
			var json = eval(data);
			if(5 == json) {
				location.href = rootPath + "/login/loginPage";
				return ;
			}
			var html = "";
			html += '<tr>';
	        html += '<th>交易编号</th>';
	        html += '<th>交易日期</th>';
	        html += '<th>资金流动</th>';
	        html += '<th>类型</th>';
	        html += '<th>产品</th>';
	        html += '<th>账户余额</th>';
	        html += '</tr>'; 
	       
	        var isResponsible = $('#isResponsible').val();
	        var userId = $('#userId').val();
	        if(json.length == 0) {
				html += '<tr><td colspan="15">没有查到相关数据！</td></tr>';
			}else {
				
				for(var i=0; i<json.length; i++) {
					var money = 0;
					var orderlineType = '';
					if(json[i].increase==null){
						money = json[i].decrease;
					}else{
						money = json[i].increase;
					}
					
					if(json[i].orderLineType=='N'){
						orderlineType = '消费';
					}else if(json[i].orderLineType=='C'){
						orderlineType = '充值';
					}else{
						orderlineType = '消费';
					}
					
					html += '<td>' + json[i].accountDetailCode + '</td>';
					html += '<td>' + json[i].operateTime + '</td>';
					html += '<td>' + money + '</td>';
					
					html += '<td>' + orderlineType + '</td>';
					html += '<td>' + json[i].goodsName + '</td>';
					html += '<td>' + json[i].balance + '</td>';
					html += '  </td>';
					html += '</tr>';
				} 
			}
			$('#dataList').html(html);
			
			//显示分页
			if(json.length) {
				var pageNow = json[0].pageNow;
				var pageSize = json[0].pageSize;
				var rowCount = json[0].rowCount;
				var pageCount = json[0].pageCount;
				
				$('#pageNow').val(pageNow);
				$('#pageSize').html("1-" + pageSize);
				$('#rowCount').html(rowCount);
				$('#pageIndex').html(pageNow);
				$('#pageCount').html(pageCount);
			}else {
				$('#pageNow').val("1");
				$('#pageSize').html("1-20");
				$('#rowCount').html("0");
				$('#pageIndex').html("1");
				$('#pageCount').html("1");
			}
			controllerWaitingBar(false);
		}
	);
}

function toExport(){
	var flag = checkfindTime();
	if(flag){
		form.submit();
	}
	
}

function getContextPathTemp() {
	var result=$("#rootPath").val();
    return result;
}

function checkfindTime(){ 
	var startTime = $("#startTime").val();
	var endTime = $("#endTime").val();
	if(startTime==null||startTime==""||endTime==null||endTime==""){
		alert("请填写查询时间！");
		return false;
	}else{
		return true;
	}
}


